﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace GBPVRLibrary.UtilityLibrary.Drawing
{
    public class Utilities
    {

        public static PointF RotatePoint(PointF pPoint, PointF pOrigin, float Degrees)
        {
            PointF result = new PointF(0, 0);
            double radians = Degrees / 180 * Math.PI;
            result.X = (float)(pOrigin.X + (Math.Cos(radians) * (pPoint.X - pOrigin.X) - Math.Sin(radians) * (pPoint.Y - pOrigin.Y)));
            result.Y = (float)(pOrigin.Y + (Math.Sin(radians) * (pPoint.X - pOrigin.X) + Math.Cos(radians) * (pPoint.Y - pOrigin.Y)));
            return result;
        }
    }
}
